

// (1 - exp(-sqrt(w)))/( 1 - exp(-1.0))


sub r0, inPos, c[MODEL_SPACE_CAMERA_POS_OOFOG_RANGE]
mul r0, r0, c[MODEL_SPACE_CAMERA_POS_OOFOG_RANGE].w	// r0 = pos/range
dp3 r0.x, r0, r0					// r0 = |pos/range|^2

;variant 0 density = constant
;mov r0.x, c[CONSTANT_0_05_1_2].z

;variant 1 density = r^2
;sub r0.x, c[CONSTANT_0_05_1_2].z, r0.x

;variant 2 density = 1/(1 + r^2)
add r0.x, r0.x, c[CONSTANT_0_05_1_2].z
rcp r0.x, r0.x

;variant 3 density = r
;rsq r0.x, r0.x
;rcp r0.x, r0.x
;sub r0.x, c[CONSTANT_0_05_1_2].z, r0.x

;variant 4 density = 1 - constant * exp(r) = 1 - 2^(-r^2) 
;exp r0.x, -r0.x


mov oFog, r0.x

max r0.x, r0.x, c[CONSTANT_0_05_1_2].x
add r0.x, r0.x, c[MORPH_WEIGHT_MW_1MINUSMW_0_ISFOGOPAQUE].w
min r0.x, r0.x, c[CONSTANT_0_05_1_2].z
;mov r0.x, c[CONSTANT_0_05_1_2].z
mov inNormal.w, r0.x
